OBJDIRS += lib

LIB_SRCFILES :=		lib/console.c \
			lib/libmain.c \
			lib/exit.c \
			lib/panic.c \
			lib/printf.c \
			lib/printfmt.c \
			lib/readline.c \
			lib/string.c \
			lib/syscall.c




LIB_OBJFILES := $(patsubst lib/%.c, $(OBJDIR)/lib/%.o, $(LIB_SRCFILES))
LIB_OBJFILES := $(patsubst lib/%.S, $(OBJDIR)/lib/%.o, $(LIB_OBJFILES))

$(OBJDIR)/lib/%.o: lib/%.c
	@echo + cc[USER] $<
	@mkdir -p $(@D)
	$(V)$(CC) -nostdinc $(USER_CFLAGS) -c -o $@ $<

$(OBJDIR)/lib/%.o: lib/%.S
	@echo + as[USER] $<
	@mkdir -p $(@D)
	$(V)$(CC) -nostdinc $(USER_CFLAGS) -c -o $@ $<

$(OBJDIR)/lib/libjos.a: $(LIB_OBJFILES)
	@echo + ar $@
	$(V)$(AR) r $@ $(LIB_OBJFILES)

# vim: ft=make

